package com.guchenbo.example.thread.singleton;

/**
 * @Author guchenbo
 * @Date 2019/7/5.
 */
public class SyncSingletonFactory {

    private static Singleton instance;

    public static synchronized Singleton getInstance(){
        if (instance == null) {
            System.out.println(Thread.currentThread().getName() + " create instance");
            instance = new Singleton();
        }
        return instance;
    }
}
